<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>我的收益 - 奢享时光</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  <style>
    :root {
      --primary-gradient: linear-gradient(135deg, #7F00FF, #E100FF);
      --secondary-gradient: linear-gradient(135deg, #00F5A0, #00D9F5);
      --primary-color: #7F00FF;
      --secondary-color: #00F5A0;
      --accent-color: #FFE600;
      --dark-bg: #2D1B69;
      --light-bg: #6B3FA0;
      --text-light: #FFFFFF;
      --text-secondary: #E0D5FF;
      --card-bg: rgba(255, 255, 255, 0.1);
      --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
      --border-radius: 16px;
      --border: 1px solid rgba(255, 255, 255, 0.18);
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
    }

    body {
      font-family: 'Noto Sans SC', 'Poppins', sans-serif;
      background: var(--dark-bg);
      color: var(--text-light);
      font-size: 14px;
      line-height: 1.5;
      overflow-x: hidden;
    }

    a {
      text-decoration: none;
      color: inherit;
    }

    button {
      font-family: inherit;
      cursor: pointer;
      border: none;
      outline: none;
    }

    .app-container {
      max-width: 480px;
      margin: 0 auto;
      min-height: 100vh;
      background: linear-gradient(180deg, var(--dark-bg), var(--light-bg));
      position: relative;
      overflow: hidden;
      padding-bottom: 70px;
    }

    /* 背景装饰 */
    .bg-decoration {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 0;
      pointer-events: none;
      overflow: hidden;
    }

    .bg-circle {
      position: absolute;
      border-radius: 50%;
    }

    .bg-circle:nth-child(1) {
      width: 300px;
      height: 300px;
      top: -150px;
      right: -100px;
      background: radial-gradient(circle, rgba(225, 0, 255, 0.2), rgba(225, 0, 255, 0));
    }

    .bg-circle:nth-child(2) {
      width: 250px;
      height: 250px;
      bottom: 10%;
      left: -100px;
      background: radial-gradient(circle, rgba(0, 245, 160, 0.15), rgba(0, 245, 160, 0));
    }

    /* 顶部导航 */
    .header {
      position: sticky;
      top: 0;
      z-index: 100;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      background: rgba(45, 27, 105, 0.8);
      padding: 15px 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: var(--border);
    }

    .back-button {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.1);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
    }

    .page-title {
      font-size: 18px;
      font-weight: 600;
    }

    .header-actions {
      display: flex;
      gap: 15px;
    }

    .header-actions i {
      font-size: 18px;
      color: var(--text-light);
      opacity: 0.9;
    }

    /* 内容区域 */
    .content {
      position: relative;
      z-index: 1;
      padding: 20px;
    }

    /* 收益概览卡片 */
    .earnings-card {
      background: var(--primary-gradient);
      border-radius: var(--border-radius);
      padding: 25px 20px;
      margin-bottom: 25px;
      box-shadow: var(--shadow);
      position: relative;
      overflow: hidden;
    }

    .card-bg-element {
      position: absolute;
      opacity: 0.1;
      color: white;
    }

    .card-bg-element:nth-child(1) {
      right: -20px;
      top: -20px;
      font-size: 120px;
      transform: rotate(15deg);
    }

    .card-bg-element:nth-child(2) {
      left: 20px;
      bottom: -30px;
      font-size: 100px;
      transform: rotate(-10deg);
    }

    .earnings-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
    }

    .earnings-title {
      font-size: 16px;
      color: var(--text-secondary);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .time-filter {
      background: rgba(255, 255, 255, 0.2);
      border-radius: 20px;
      padding: 5px 15px;
      font-size: 12px;
      display: flex;
      align-items: center;
      gap: 5px;
    }

    .earnings-value {
      font-size: 36px;
      font-weight: 700;
      margin-bottom: 5px;
    }

    .earnings-label {
      font-size: 14px;
      opacity: 0.8;
    }

    .time-range {
      display: flex;
      gap: 10px;
      margin-top: 15px;
    }

    .time-item {
      background: rgba(255, 255, 255, 0.2);
      border-radius: 16px;
      padding: 8px 15px;
      font-size: 13px;
      cursor: pointer;
      transition: all 0.3s;
    }

    .time-item.active {
      background: rgba(255, 255, 255, 0.3);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    /* 收益来源卡片 */
    .section-card {
      background: rgba(255, 255, 255, 0.1);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border-radius: var(--border-radius);
      padding: 20px;
      margin-bottom: 20px;
      border: var(--border);
    }

    .section-title {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 15px;
      color: var(--text-light);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .source-list {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 15px;
    }

    .source-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 15px;
      background: rgba(255, 255, 255, 0.05);
      border-radius: 12px;
      transition: all 0.3s;
    }

    .source-item:hover {
      background: rgba(255, 255, 255, 0.1);
    }

    .source-icon {
      width: 40px;
      height: 40px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      background: var(--primary-gradient);
    }

    .source-item:nth-child(2) .source-icon {
      background: var(--secondary-gradient);
    }

    .source-item:nth-child(3) .source-icon {
      background: linear-gradient(135deg, #FFB400, #FF5A5A);
    }

    .source-item:nth-child(4) .source-icon {
      background: linear-gradient(135deg, #3B82F6, #2DD4BF);
    }

    .source-info {
      flex: 1;
    }

    .source-name {
      font-size: 13px;
      margin-bottom: 4px;
    }

    .source-value {
      font-size: 16px;
      font-weight: 600;
    }

    /* 收益明细 */
    .tab-header {
      display: flex;
      gap: 2px;
      margin-bottom: 15px;
      background: rgba(255, 255, 255, 0.05);
      border-radius: 10px;
      padding: 3px;
    }

    .tab-item {
      flex: 1;
      text-align: center;
      padding: 10px;
      font-size: 13px;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .tab-item.active {
      background: rgba(255, 255, 255, 0.15);
      font-weight: 500;
    }

    .earnings-list {
      margin-top: 10px;
    }

    .earning-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 15px 10px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .earning-info {
      display: flex;
      gap: 12px;
      align-items: center;
    }

    .earning-icon {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      background: rgba(255, 255, 255, 0.1);
    }

    .earning-detail h4 {
      font-size: 14px;
      font-weight: 500;
      margin-bottom: 3px;
    }

    .earning-detail p {
      font-size: 12px;
      opacity: 0.7;
    }

    .earning-amount {
      font-size: 16px;
      font-weight: 600;
      color: var(--secondary-color);
    }

    /* 收益趋势 */
    .chart-container {
      height: 220px;
      margin-top: 15px;
      position: relative;
    }

    .chart-loader {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      text-align: center;
    }

    .spinner {
      width: 40px;
      height: 40px;
      margin: 0 auto 10px;
      border: 3px solid rgba(255, 255, 255, 0.1);
      border-top-color: var(--secondary-color);
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    .chart-legend {
      display: flex;
      justify-content: center;
      gap: 20px;
      margin-top: 15px;
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 12px;
    }

    .legend-color {
      width: 10px;
      height: 10px;
      border-radius: 2px;
    }

    .no-data {
      text-align: center;
      padding: 30px 0;
      color: var(--text-secondary);
    }

    /* 提现按钮 */
    .withdraw-button {
      display: block;
      width: 100%;
      background: var(--secondary-gradient);
      border-radius: 12px;
      padding: 15px;
      font-size: 16px;
      font-weight: 500;
      color: var(--dark-bg);
      text-align: center;
      margin-top: 30px;
      transition: all 0.3s;
      box-shadow: 0 4px 15px rgba(0, 245, 160, 0.2);
    }

    .withdraw-button:active {
      transform: translateY(2px);
      box-shadow: 0 2px 8px rgba(0, 245, 160, 0.2);
    }

    /* 加载动画 */
    .fade-in {
      animation: fadeIn 0.5s ease-in-out;
    }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(10px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* 底部导航 */
    .bottom-nav {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: rgba(45, 27, 105, 0.9);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      display: flex;
      max-width: 480px;
      margin: 0 auto;
      border-top: var(--border);
      z-index: 100;
    }

    .nav-item {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 12px 0;
      font-size: 12px;
    }

    .nav-item i {
      font-size: 20px;
      margin-bottom: 5px;
    }

    .nav-item.active {
      color: var(--accent-color);
    }
  </style>
</head>
<body>
  <div class="app-container">
    <!-- 背景装饰 -->
    <div class="bg-decoration">
      <div class="bg-circle"></div>
      <div class="bg-circle"></div>
    </div>

    <!-- 顶部导航 -->
    <div class="header">
      <a href="wallet.html" class="back-button">
        <i class="fas fa-arrow-left"></i>
      </a>
      <div class="page-title">我的收益</div>
      <div class="header-actions">
        <i class="fas fa-question-circle"></i>
      </div>
    </div>

    <!-- 内容区域 -->
    <div class="content">
      <!-- 收益概览 -->
      <div class="earnings-card fade-in">
        <div class="card-bg-element">
          <i class="fas fa-chart-line"></i>
        </div>
        <div class="card-bg-element">
          <i class="fas fa-sack-dollar"></i>
        </div>
        
        <div class="earnings-header">
          <div class="earnings-title">
            <i class="fas fa-chart-line"></i>
            收益概览
          </div>
          <div class="time-filter">
            <span id="current-filter">本月</span>
            <i class="fas fa-chevron-down"></i>
          </div>
        </div>

        <div class="earnings-value" id="total-earnings">¥2,568.50</div>
        <div class="earnings-label">总收益（预计下个结算日可提现）</div>

        <div class="time-range">
          <div class="time-item" data-period="day">今日</div>
          <div class="time-item" data-period="week">本周</div>
          <div class="time-item active" data-period="month">本月</div>
          <div class="time-item" data-period="all">全部</div>
        </div>
      </div>

      <!-- 收益来源 -->
      <div class="section-card fade-in" style="animation-delay: 0.1s;">
        <div class="section-title">
          <i class="fas fa-pie-chart"></i>
          收益来源
        </div>
        <div class="source-list">
          <div class="source-item">
            <div class="source-icon">
              <i class="fas fa-users"></i>
            </div>
            <div class="source-info">
              <div class="source-name">团队奖励</div>
              <div class="source-value">¥1,286.00</div>
            </div>
          </div>
          <div class="source-item">
            <div class="source-icon">
              <i class="fas fa-shopping-bag"></i>
            </div>
            <div class="source-info">
              <div class="source-name">拼团佣金</div>
              <div class="source-value">¥876.50</div>
            </div>
          </div>
          <div class="source-item">
            <div class="source-icon">
              <i class="fas fa-user-plus"></i>
            </div>
            <div class="source-info">
              <div class="source-name">推荐奖励</div>
              <div class="source-value">¥356.00</div>
            </div>
          </div>
          <div class="source-item">
            <div class="source-icon">
              <i class="fas fa-gift"></i>
            </div>
            <div class="source-info">
              <div class="source-name">活动奖励</div>
              <div class="source-value">¥50.00</div>
            </div>
          </div>
        </div>
      </div>

      <!-- 收益明细 -->
      <div class="section-card fade-in" style="animation-delay: 0.2s;">
        <div class="section-title">
          <i class="fas fa-list"></i>
          收益明细
        </div>
        <div class="tab-header">
          <div class="tab-item active" data-type="all">全部</div>
          <div class="tab-item" data-type="team">团队奖励</div>
          <div class="tab-item" data-type="commission">拼团佣金</div>
          <div class="tab-item" data-type="referral">推荐奖励</div>
        </div>

        <div class="earnings-list">
          <div class="earning-item">
            <div class="earning-info">
              <div class="earning-icon">
                <i class="fas fa-users"></i>
              </div>
              <div class="earning-detail">
                <h4>团队拼团奖励</h4>
                <p>2023-11-28 14:30</p>
              </div>
            </div>
            <div class="earning-amount">+¥328.00</div>
          </div>
          
          <div class="earning-item">
            <div class="earning-info">
              <div class="earning-icon">
                <i class="fas fa-shopping-bag"></i>
              </div>
              <div class="earning-detail">
                <h4>奢华护肤套装拼团佣金</h4>
                <p>2023-11-27 09:15</p>
              </div>
            </div>
            <div class="earning-amount">+¥186.50</div>
          </div>
          
          <div class="earning-item">
            <div class="earning-info">
              <div class="earning-icon">
                <i class="fas fa-user-plus"></i>
              </div>
              <div class="earning-detail">
                <h4>推荐新用户奖励</h4>
                <p>2023-11-26 18:45</p>
              </div>
            </div>
            <div class="earning-amount">+¥68.00</div>
          </div>
          
          <div class="earning-item">
            <div class="earning-info">
              <div class="earning-icon">
                <i class="fas fa-users"></i>
              </div>
              <div class="earning-detail">
                <h4>团队拼团奖励</h4>
                <p>2023-11-25 10:20</p>
              </div>
            </div>
            <div class="earning-amount">+¥245.00</div>
          </div>
          
          <div class="earning-item">
            <div class="earning-info">
              <div class="earning-icon">
                <i class="fas fa-gift"></i>
              </div>
              <div class="earning-detail">
                <h4>双十一活动奖励</h4>
                <p>2023-11-11 00:00</p>
              </div>
            </div>
            <div class="earning-amount">+¥50.00</div>
          </div>
        </div>
      </div>

      <!-- 收益趋势 
      <div class="section-card fade-in" style="animation-delay: 0.3s;">
        <div class="section-title">
          <i class="fas fa-chart-line"></i>
          收益趋势
        </div>
        <div class="chart-container">
          <div class="chart-loader" id="chart-loader">
            <div class="spinner"></div>
            <div>加载中...</div>
          </div>
          <canvas id="earnings-chart"></canvas>
        </div>
        <div class="chart-legend">
          <div class="legend-item">
            <div class="legend-color" style="background: #7F00FF;"></div>
            <span>团队奖励</span>
          </div>
          <div class="legend-item">
            <div class="legend-color" style="background: #00F5A0;"></div>
            <span>拼团佣金</span>
          </div>
          <div class="legend-item">
            <div class="legend-color" style="background: #E100FF;"></div>
            <span>推荐奖励</span>
          </div>
        </div>
      </div>-->

      <!-- 提现按钮 
      <a href="wallet.html" class="withdraw-button fade-in" style="animation-delay: 0.4s;">
        立即提现
      </a>-->
    </div>

    <!-- 底部导航 -->
    <div class="bottom-nav">
      <a href="index.html" class="nav-item">
        <i class="fas fa-home"></i>
        <span>首页</span>
      </a>
      <a href="groupbuy.html" class="nav-item">
        <i class="fas fa-users"></i>
        <span>拼团</span>
      </a>
      <a href="shares.html" class="nav-item">
        <i class="fas fa-chart-pie"></i>
        <span>股权</span>
      </a>
      <a href="profile.html" class="nav-item active">
        <i class="fas fa-user"></i>
        <span>我的</span>
      </a>
    </div>
  </div>

  <script>
    // DOM 加载完成后执行
    document.addEventListener('DOMContentLoaded', function() {
      // 时间筛选切换
      const timeItems = document.querySelectorAll('.time-item');
      const currentFilter = document.getElementById('current-filter');
      const totalEarnings = document.getElementById('total-earnings');
      
      // 收益数据（模拟数据）
      const earningsData = {
        day: '¥186.50',
        week: '¥867.00',
        month: '¥2,568.50',
        all: '¥15,472.00'
      };
      
      timeItems.forEach(item => {
        item.addEventListener('click', function() {
          // 移除所有active类
          timeItems.forEach(i => i.classList.remove('active'));
          // 添加当前active类
          this.classList.add('active');
          
          // 更新筛选显示
          const period = this.dataset.period;
          const periodText = this.textContent;
          currentFilter.textContent = periodText;
          
          // 更新收益金额
          totalEarnings.textContent = earningsData[period];
          
          // 更新图表数据
          updateChartData(period);
        });
      });
      
      // 明细标签切换
      const tabItems = document.querySelectorAll('.tab-item');
      const earningItems = document.querySelectorAll('.earning-item');
      
      tabItems.forEach(tab => {
        tab.addEventListener('click', function() {
          // 移除所有active类
          tabItems.forEach(t => t.classList.remove('active'));
          // 添加当前active类
          this.classList.add('active');
          
          // 切换明细显示
          const type = this.dataset.type;
          if (type === 'all') {
            earningItems.forEach(item => item.style.display = 'flex');
          } else {
            earningItems.forEach(item => {
              const iconClass = item.querySelector('.earning-icon i').className;
              if (
                (type === 'team' && iconClass.includes('fa-users')) ||
                (type === 'commission' && iconClass.includes('fa-shopping-bag')) ||
                (type === 'referral' && iconClass.includes('fa-user-plus'))
              ) {
                item.style.display = 'flex';
              } else {
                item.style.display = 'none';
              }
            });
          }
        });
      });
      
      // 初始化图表
      initChart();
      
      function initChart() {
        // 模拟加载延迟
        setTimeout(() => {
          document.getElementById('chart-loader').style.display = 'none';
          
          const ctx = document.getElementById('earnings-chart').getContext('2d');
          
          // 图表渐变背景
          const gradient = ctx.createLinearGradient(0, 0, 0, 250);
          gradient.addColorStop(0, 'rgba(127, 0, 255, 0.5)');
          gradient.addColorStop(1, 'rgba(127, 0, 255, 0)');
          
          // 创建图表
          window.earningsChart = new Chart(ctx, {
            type: 'line',
            data: {
              labels: ['1日', '5日', '10日', '15日', '20日', '25日', '30日'],
              datasets: [
                {
                  label: '团队奖励',
                  data: [150, 230, 380, 290, 400, 360, 320],
                  borderColor: '#7F00FF',
                  backgroundColor: 'rgba(127, 0, 255, 0.1)',
                  borderWidth: 2,
                  tension: 0.4,
                  pointBackgroundColor: '#7F00FF',
                  pointRadius: 3,
                  pointHoverRadius: 5
                },
                {
                  label: '拼团佣金',
                  data: [100, 180, 160, 200, 120, 180, 150],
                  borderColor: '#00F5A0',
                  backgroundColor: 'rgba(0, 245, 160, 0.1)',
                  borderWidth: 2,
                  tension: 0.4,
                  pointBackgroundColor: '#00F5A0',
                  pointRadius: 3,
                  pointHoverRadius: 5
                },
                {
                  label: '推荐奖励',
                  data: [50, 70, 30, 60, 80, 40, 45],
                  borderColor: '#E100FF',
                  backgroundColor: 'rgba(225, 0, 255, 0.1)',
                  borderWidth: 2,
                  tension: 0.4,
                  pointBackgroundColor: '#E100FF',
                  pointRadius: 3,
                  pointHoverRadius: 5
                }
              ]
            },
            options: {
              responsive: true,
              maintainAspectRatio: false,
              plugins: {
                legend: {
                  display: false
                },
                tooltip: {
                  backgroundColor: 'rgba(45, 27, 105, 0.9)',
                  titleColor: '#fff',
                  bodyColor: '#fff',
                  borderColor: 'rgba(255, 255, 255, 0.2)',
                  borderWidth: 1,
                  padding: 10,
                  displayColors: true,
                  mode: 'index',
                  intersect: false
                }
              },
              scales: {
                x: {
                  grid: {
                    display: false,
                    drawBorder: false
                  },
                  ticks: {
                    color: 'rgba(224, 213, 255, 0.6)',
                    font: {
                      size: 10
                    }
                  }
                },
                y: {
                  grid: {
                    color: 'rgba(255, 255, 255, 0.05)',
                    drawBorder: false
                  },
                  ticks: {
                    color: 'rgba(224, 213, 255, 0.6)',
                    font: {
                      size: 10
                    },
                    stepSize: 100,
                    callback: function(value) {
                      return '¥' + value;
                    }
                  }
                }
              }
            }
          });
        }, 1000);
      }
      
      function updateChartData(period) {
        // 模拟不同时间段的数据
        let labels, dataset1, dataset2, dataset3;
        
        switch(period) {
          case 'day':
            labels = ['10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00'];
            dataset1 = [20, 35, 45, 30, 50, 40, 25];
            dataset2 = [15, 25, 30, 40, 20, 35, 30];
            dataset3 = [5, 10, 5, 8, 12, 7, 10];
            break;
          case 'week':
            labels = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
            dataset1 = [80, 120, 150, 90, 130, 160, 140];
            dataset2 = [60, 90, 70, 100, 50, 80, 65];
            dataset3 = [30, 20, 25, 15, 40, 35, 25];
            break;
          case 'all':
            labels = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];
            dataset1 = [500, 650, 800, 750, 900, 1000, 1200, 1100, 950, 1300, 1400, 1500];
            dataset2 = [400, 500, 450, 600, 550, 700, 650, 800, 750, 900, 850, 1000];
            dataset3 = [200, 150, 250, 200, 300, 350, 300, 250, 400, 350, 450, 500];
            break;
          default: // month
            labels = ['1日', '5日', '10日', '15日', '20日', '25日', '30日'];
            dataset1 = [150, 230, 380, 290, 400, 360, 320];
            dataset2 = [100, 180, 160, 200, 120, 180, 150];
            dataset3 = [50, 70, 30, 60, 80, 40, 45];
        }
        
        // 更新图表数据
        if (window.earningsChart) {
          window.earningsChart.data.labels = labels;
          window.earningsChart.data.datasets[0].data = dataset1;
          window.earningsChart.data.datasets[1].data = dataset2;
          window.earningsChart.data.datasets[2].data = dataset3;
          window.earningsChart.update();
        }
      }
    });
  </script>
</body>
</html> 